home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Technotools
/
Technotools (Chestnut CD-ROM)(1993).ISO
/
batch
/
tsbat30
/
scanz.bat
< prev
next >
Wrap
DOS Batch File
|
1991-09-01
|
5KB
|
170 lines
echo off
echo.
echo ┌───────────────────────────────────────────────────────────┐
echo │ Scan a zip file for viruses including execompressed files │
echo │ By Prof. Timo Salmi, ts@chyde.uwasa.fi, Sun 01-Sep-1991 │
echo └───────────────────────────────────────────────────────────┘
echo.
rem If no parameters then give the instructions
if "%1"=="" goto _help
rem First check that the zip file(s) exists
if not exist %1 goto _err1
rem Check that you have the drive r: available (I have r: as ramdisk)
if not exist r:\nul goto _err2
rem Check that the virus programs are available
if not exist c:\tools\scan.exe goto _err3
if not exist c:\tools\f-fchk.exe goto _err4
if not exist c:\tools\sign.txt goto _err5
rem Check that pkunzip.exe is available
if not exist c:\tools\pkunzip.exe goto _err6
rem Check that exeuncompressors are available
if not exist c:\tools\pklite.exe goto _err7
if not exist c:\box\boxtools\unlzexe.exe goto _err8
if not exist c:\box\boxtools\diet.exe goto _err9
rem Check that the ask.exe facility is available
set _found=
if exist ask.exe set _found=yes
for %%d in (%path%) do if exist %%d\ask.exe set _found=yes
if not "%_found%"=="yes" goto _err10
rem Make a temporary directory and ensure that it is empty
if not exist r:\tmp$$$\nul mkdir r:\tmp$$$
if exist r:\tmp$$$\*.* echo Delete all old files from r:\TMP$$$ directory
if exist r:\tmp$$$\*.* del r:\tmp$$$\*.*
rem Unzip all .exe, .com, overlay-files and embedded zips from the zipfile
c:\tools\pkunzip %1 *.exe *.com *.ov* *.zip r:\tmp$$$
if exist r:\tmp$$$\*.zip c:\tools\pkunzip r:\tmp$$$\*.zip r:\tmp$$$
if exist r:\tmp$$$\*.zip del r:\tmp$$$\*.zip
if errorlevel=1 goto _ziperror
rem Check for nasties with scan, first pass
if exist r:\tmp$$$\*.* scan /a r:\tmp$$$\*.* /nomem
if errorlevel=2 goto _scanerr
if errorlevel=1 goto _virus
rem Check for nasties with f-fchk, first pass
if exist r:\tmp$$$\*.* f-fchk r:\tmp$$$\*.* /all
:_ask1
echo.
ask Next second pass, with expansion, continue (y/n)? /d /u
if errorlevel==89 if not errorlevel==90 goto _expand
if errorlevel==78 if not errorlevel==79 goto _rmdir
goto _ask1
rem Expand execompressed files
:_expand
for %%f in (r:\tmp$$$\*.exe r:\tmp$$$\*.com) do c:\tools\pklite -x %%f
for %%f in (r:\tmp$$$\*.exe r:\tmp$$$\*.com) do c:\box\boxtools\diet -ra %%f
:_ask2
ask Try to expand lzexed files (y/n)? /d /u
if errorlevel==89 if not errorlevel==90 goto _unlzexe
if errorlevel==78 if not errorlevel==79 goto _nounlzexe
goto _ask2
:_unlzexe
for %%f in (r:\tmp$$$\*.exe) do c:\box\boxtools\unlzexe %%f
if exist r:\tmp$$$\*.olz del r:\tmp$$$\*.olz
:_nounlzexe
rem Check for nasties with scan, second pass
if exist r:\tmp$$$\*.* scan /a r:\tmp$$$\*.* /nomem
if errorlevel=2 goto _scanerr
if errorlevel=1 goto _virus
rem Check for nasties with f-fchk, second pass
if exist r:\tmp$$$\*.* f-fchk r:\tmp$$$\*.* /all
goto _rmdir
:_virus
echo Viruses have been detected, batch terminated
echo The infected files remain in directory r:\TMP$$$
echo Take immediate measures to protect yourself
goto _out
rem Error in zipfile
:_ziperror
echo Error in .zip file, batch terminated
rem Remove the temporary directory and its files
:_rmdir
if not exist r:\tmp$$$\*.* goto _chdir
echo y | del r:\tmp$$$\*.* > nul
:_chdir
cd r:\
if exist r:\tmp$$$\nul rmdir r:\tmp$$$
goto _out
rem The instructions
:_help
echo Usage: SCANZ [ZipFileName]
echo.
echo You will need the following shareware and PD programs to use this batch.
echo They are available from good BBSes or from garbo.uwasa.fi by anonymous ftp.
echo PKUNZIP.EXE from PKZ110.EXE or PKZ110EU.EXE
echo SCAN.EXE from SCANV80.ZIP
echo F-FCHK.EXE and SIGN.TXT from FPROT116.ZIP
echo PKLITE.EXE from PKLTE105.EXE
echo UNLZEXE.EXE from UNLZEXE5.ZIP
echo DIET.EXE from DIET110A.ZIP
echo ASK.EXE from TSBAT26.ARC
echo Before using this batch you have to edit all the directory paths of this
echo batch to correspond to your own configuration.
echo.
goto _out
:_err1
echo File %1 not found
goto _out
:_err2
echo Drive R: not found
echo Adjust your configuration or this batch
goto _out
:_err3
echo File c:\tools\scan.exe not found
goto _out
:_err4
echo File c:\tools\f-fchk.exe not found
goto _out
:_err5
echo File c:\tools\sign.txt not found
goto _out
:_err6
echo File c:\tools\pkunzip.exe not found
goto _out
:_err7
echo File c:\tools\pklite.exe not found
goto _out
:_err8
echo File c:\box\boxtools\unlzexe.exe not found
goto _out
:_err9
echo File c:\box\boxtools\diet.exe not found
goto _out
:_err10
echo Timo's ask.exe must be at path or current directory
goto _out
:_scanerr
echo Abnormal SCAN program termination
goto _out
:_out
set _found=
echo on